# 创建有效的占位图片文件

Write-Host "正在创建占位图片文件..." -ForegroundColor Green

# 创建一个最小的有效 JPEG 文件（白色 1x1 像素）
$minimalJpeg = [byte[]]@(
    0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x48, 0x00, 0x48, 0x00, 0x00,
    0xFF, 0xDB, 0x00, 0x43, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0,
    0x00, 0x11, 0x08, 0x00, 0x01, 0x00, 0x01, 0x03, 0x01, 0x22, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0xFF, 0xC4, 0x00,
    0x14, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
    0xFF, 0xDA, 0x00, 0x08, 0x01, 0x01, 0x00, 0x00, 0x3F, 0x00, 0x95, 0xFF, 0xD9
)

# JPG 文件列表
$jpgFiles = @(
    "banner1.jpg",
    "banner2.jpg", 
    "banner3.jpg",
    "course1.jpg",
    "course2.jpg",
    "course3.jpg",
    "course4.jpg",
    "avatar1.jpg",
    "avatar2.jpg",
    "avatar3.jpg",
    "post1.jpg",
    "post2.jpg",
    "post3.jpg",
    "post4.jpg",
    "post5.jpg",
    "post6.jpg",
    "share.jpg"
)

# 创建一个最小的有效 PNG 文件
$minimalPng = [byte[]]@(
    0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 
    0x00, 0x00, 0x00, 0x01, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1F, 0x15, 0xC4, 0x89, 0x00, 0x00, 0x00, 0x0A, 0x49, 0x44, 0x41, 
    0x54, 0x78, 0x9C, 0x63, 0x00, 0x01, 0x00, 0x00, 0x05, 0x00, 0x01, 0x0D, 0x0A, 0x2D, 0xB4, 0x00, 0x00, 0x00, 0x00, 0x49, 
    0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82
)

# 创建所有 JPG 文件
foreach ($file in $jpgFiles) {
    try {
        [System.IO.File]::WriteAllBytes($file, $minimalJpeg)
        Write-Host "✓ 创建: $file" -ForegroundColor Cyan
    } catch {
        Write-Host "✗ 失败: $file" -ForegroundColor Red
    }
}

# 创建 category6.png
try {
    [System.IO.File]::WriteAllBytes("category6.png", $minimalPng)
    Write-Host "✓ 创建: category6.png" -ForegroundColor Cyan
} catch {
    Write-Host "✗ 失败: category6.png" -ForegroundColor Red
}

Write-Host "`n所有图片文件创建完成！" -ForegroundColor Green
Write-Host "这些是有效的占位图片，小程序可以正常加载。" -ForegroundColor Yellow
Write-Host "建议后续替换为实际的图片内容。" -ForegroundColor Yellow


